package edu.gatech.ors.mrsim.core;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import edu.gatech.ors.mrsim.io.logging.Logging;

public abstract class Node {
	// simulated "current time"
	protected long currentTime;

	// the identifier of this module
	protected String name;

	protected List<NodeConnection> connections;

	protected final Logger LOGGER = Logging.getInstance().getClassLogger(this.getClass());

	public Node(String name) {
		this.name = name;
		connections = new ArrayList<NodeConnection>();
	}

	public abstract List<Event<?>> respondToEventCompletion(Event<?> event);

	public void setTime(long currentTime) {
		this.currentTime = currentTime;
	}

	public long getTime() {
		return currentTime;
	}

	public String getName() {
		return name;
	}

	public void alterTime(long amount) {
		currentTime += amount;
	}

	public List<NodeConnection> getConnections() {
		return connections;
	}

	public boolean equals(Object other) {
		if (!(other instanceof Node))
			return false;
		Node otherNode = (Node) other;
		return this.name.equals(otherNode.getName());
	}

}
